local que_shenen = fk.CreateSkill {
    name = "que_shenen",
    anim_type = "control",
    tags = { Skill.Compulsory }
}
Fk:loadTranslationTable {
    ["que_shenen"] = "神恩",
    [":que_shenen"] = "锁定技，游戏开始时，你选择一名角色的一个技能，令此技能于其对应发动时机的发动次数永久+1，当其于回合内发动该技能后，" ..
        "你摸一张牌；若该角色不为你，其进入濒死状态时，你弃置所有手牌并失去一点体力。<font color='red'>(注：若选择了限定技，则仅可额外发动一次)",

    ["@que_shenen"] = "神恩",
}
que_shenen:addEffect(fk.GameStart, {
    anim_type = "drawcard",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(que_shenen.name)
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local to = room:askToChoosePlayers(
            player,
            {
                targets = room.alive_players,
                min_num = 1,
                max_num = 1,
                prompt = "神恩：请选择一名角色，对其附加神恩",
                skill_name = que_shenen.name,
            }
        )
        if #to > 0 then
            event:setCostData(self, { tos = to })
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self).tos[1]
        local skills = table.map(to.player_skills, function(s) return s.name end)
        if #skills == 0 then return end
        if #skills > 0 then
            local sname = room:askToChoices(player,
                { skill_name = que_shenen.name, choices = skills, min_num = 1, max_num = 1, cancelable = false })
            room:setPlayerMark(to, "@que_shenen", sname)
        end
    end,
})

que_shenen:addEffect(fk.AfterSkillEffect, {
    anim_type = "offensive",
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        local mark = player:getTableMark("@que_shenen")
        return #mark ~= 0 and target == player and table.contains(mark, data.skill.name) and
            not data.skill:hasTag(Skill.Wake) and player.phase ~= Player.NotActive and
            player:getMark("shenenlose-turn") == 0
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        player.room:setPlayerMark(player, "shenenlose-turn", 1)
        local id = table.find(room.alive_players, function(p)
            return p:hasSkill(que_shenen.name)
        end)
        if id then
            room:notifySkillInvoked(id, 'que_shenen', 'special')
            id:drawCards(1, que_shenen.name)
        end
        if data.skill:hasTag(Skill.Limited) then
            player.room:setPlayerMark(player, "@que_shenen", 0)
        end
        player:addSkillUseHistory(data.skill.name, -1)
    end,
})

que_shenen:addEffect(fk.EnterDying, {
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        local mark = target:getTableMark("@que_shenen")
        return player:hasSkill(que_shenen.name) and #mark > 0 and target ~= player
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        player:throwAllCards("h", que_shenen.name)
        room:loseHp(player, 1, que_shenen.name)
    end,
})
return que_shenen
